{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!--BOOK_INFORMATION-->\n",
    "<img align=\"left\" style=\"padding-right:10px;\" src=\"figures/PHydro-cover-small.png\">\n",
    "*This is the Jupyter notebook version of the [Python in Hydrology](http://www.greenteapress.com/pythonhydro/pythonhydro.html) by Sat Kumar Tomer.*\n",
    "*Source code is available at [code.google.com](https://code.google.com/archive/p/python-in-hydrology/source).*\n",
    "\n",
    "*The book is available under the [GNU Free Documentation License](http://www.gnu.org/copyleft/fdl.html). If you have comments, corrections or suggestions, please send email to satkumartomer@gmail.com.*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<!--NAVIGATION-->\n",
    "< [Date Axis](07.01-Date-Axis.ipynb) | [Contents](Index.ipynb) | [Pie Charts](07.03-Pie-Charts.ipynb) >"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 7.2 条形图\n",
    "\n",
    "让我们首先创建一些数据。我们将创建两个长度为5的变量(降雨和径流)。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "n = 5\n",
    "rainfall_mean = 500 + 300*np.random.random(n)\n",
    "runoff_mean = 0.75*np.random.random(n)*rainfall_mean"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`bar`要求x的对应值，而且它本身并不计算。我们也指定条的宽度。`plt.bar`返回的矩形补丁可用于修改补丁或从中提取一些信息。在这个例子中，这些矩形的补丁被用于提取它们的高度，然后将文本放在条的顶部。图7.12显示了条形图。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEICAYAAABI7RO5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmU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fb+Ch4H5XqY0v2OThim0OpRJ3jcfw5uCD4/lHwPiIZ8WvKERERiYmaqkREJCZKHCIiEhMlDhERiYkSh4iIxESJQ0REYqLEISIiMVHiEBGRmPx/9tb1z6PvBYQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1c5c0abd080>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ind = np.arange(n)  # the x locations for the groups\n",
    "width = 0.35      # the width of the bars\n",
    "\n",
    "rects1 = plt.bar(ind, rainfall_mean, width, color='g', label='Rainfall')\n",
    "rects2 = plt.bar(ind+width, runoff_mean, width, color='m', label='Runoff')\n",
    "\n",
    "plt.ylabel('Annual sum (mm)')\n",
    "plt.title('Water balance')\n",
    "plt.xticks(ind+width, ('2001','2002','2003','2004','2005') )\n",
    "\n",
    "def autolabel(rects):\n",
    "    # attach some text labels\n",
    "    for rect in rects:\n",
    "        height = rect.get_height()\n",
    "        plt.text(rect.get_x()+rect.get_width()/2., 1.05*height,'%d'%int(height),\n",
    "              ha='center', va='bottom')\n",
    "\n",
    "plt.legend()\n",
    "autolabel(rects1)\n",
    "autolabel(rects2)\n",
    "\n",
    "plt.ylim(ymax=1000)\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<center>图7.2:显示一个bar的例子</center>"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
